﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ALDIOrganizer.Properties;

namespace ALDIOrganizer
{
    /// <summary>
    /// 
    /// </summary>
    /// <see>
    /// HolidayType enumeration (in Enumerations folder)
    /// </see>
    public static class HolidayTypes
    {
        /// <summary>
        /// calculates GetTotal (calendar) _holiday Allowance based
        /// </summary>
        /// <param Name="workingDaysAllowance">_holiday Allowance expressed in number of working pDays</param>
        /// <returns></returns>
        /// <remarks>by definition </remarks>
        public static int totalDaysAllowance(int workingDaysAllowance)
        {
            return workingDaysAllowance + 2 * (workingDaysAllowance / 5);
        }

        public static string GetTypeName(this HolidayType _ht)
        {
            switch (_ht)
            {
                case HolidayType.regular:
                    return Resources.HOLIDAY_TYPE_regular;
                case HolidayType.unpaid:
                    return Resources.HOLIDAY_TYPE_unpaid;
                case HolidayType.paternal:
                    return Resources.HOLIDAY_TYPE_paternal;
                case HolidayType.sick:
                    return Resources.HOLIDAY_TYPE_Sick;
                case HolidayType.special:
                    return Resources.HOLIDAY_TYPE_special;
                default:
                    return String.Empty;
            }
        }


        public static List<KeyValuePair<string, int>> HolidayTypesDataSource
        {
            get
            {
                return (from HolidayType item in
                            Enum.GetValues(typeof (HolidayType))
                        select new KeyValuePair<string, int>
                            (
                                item.GetTypeName(),
                                (int) item)
                            ).ToList();
            }
        }
    }
}
